//显示什么数据
export var mapStateToProps = function(state) {
  // console.log(state)
  return {
    //结构 变量:state 在组件中使用 this.props.变量
    cart: state
  }
}
//干什么活
export var mapDispatchToProps = function(dispatch) {
  return {
    add: info => {
      console.log('加入购物车')
      dispatch({ type: '加入购物车', payload: info })
    },
    addNum: key => {
      console.log('数量加')
      dispatch({ type: '数量加', payload: key })
    },
    addNum1: key => {
      console.log('数量加一')
      dispatch({ type: '加1', payload: key })
    },
    cutNum1: key => {
      console.log('数量减一')
      dispatch({ type: '减1', payload: key })
    },
    del: key => {
      console.log('删除')
      dispatch({ type: '删除', payload: key })
    },
    checkedAll: All => {
      console.log('全选')
      dispatch({ type: '全选', payload: All })
    }
    // jie: key => {
    //   console.log('结算')
    //   dispatch({ type: '结算', payload: key })
    // }
  }
}
